package edu.ncu.service.impl;

import edu.ncu.dao.PhotoDao;
import edu.ncu.dao.UserDao;
import edu.ncu.entity.Photo;
import edu.ncu.service.PhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("photoService")
public class PhotoServiceImpl implements PhotoService {
    final PhotoDao photoDao;

    public PhotoServiceImpl(PhotoDao photoDao) {
        this.photoDao = photoDao;
    }

    @Override
    public List<Photo> findAll() {
        System.out.println("进入了photoService");
        return photoDao.findAll();
    }

    @Override
    public int savePhoto(Photo photo) {
        return photoDao.savePhoto(photo);
    }

    @Override
    public int deletePhoto(int photoId) {
        return photoDao.deletePhoto(photoId);
    }

    @Override
    public List<Photo> findByUserId(int userId) {
        return photoDao.findByUserId(userId);
    }

    @Override
    public Photo findPhotoById(int photoId) {
        return photoDao.findPhotoById(photoId);
    }
}
